import { YsRouteRecord } from "ys-ts/src/vue/router";
import Home from "@/components/Home.vue";
import Second from "@/components/Second.vue";
import Second1 from "@/components/pages/Second1.vue";
import Second2 from "@/components/pages/Second2.vue";

export function useAppRouterName(): any {
  return {
    home: "home",
    second: "second",
    second1: "second1",
    second2: "second2",
  };
}

export function useAppRouter() {
  const name = useAppRouterName();

  const cfgHome = new YsRouteRecord({
    path: "/",
    name: name.home,
    component: Home,
  });

  const cfgSecond = new YsRouteRecord({
    path: "/second/",
    name: name.second,
    component: Second,
  });

  const cfgSecond1 = new YsRouteRecord({
    path: "1",
    name: name.second1,
    component: Second1,
  });
  cfgSecond.addChildren(cfgSecond1);

  const cfgSecond2 = new YsRouteRecord({
    path: "2",
    name: name.second2,
    component: Second2,
  });
  cfgSecond.addChildren(cfgSecond2);

  return {
    cfgHome,
    cfgSecond,
  };
}
